package com.cyh.dao;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SysConstant {
    public static final Integer ROOM_LEVEL_FLOOR = 0;
    public static final Integer ROOM_LEVEL_ROOM = 1;
    public static final Integer ROOM_LEVEL_SEAT = 2;

    public static final Integer SJD_A = 0;
    public static final Integer SJD_B = 1;
    public static final Integer SJD_C = 2;


    public static final Integer USER_TYPE_STU = 0;
    public static final Integer USER_TYPE_TEACHER = 1;
    public static final Integer USER_TYPE_ADMIN = 2;


    public static Map<String, List<Dict>> dict = new HashMap<>();
    static {
        ArrayList<Dict> dicts = new ArrayList<>();
        dicts.add(new Dict(0, "上午8-12点"));
        dicts.add(new Dict(1, "下午13-18点"));
        dicts.add(new Dict(2, "晚上19-22点"));
        dict.put("timeInterval",dicts);

        dicts = new ArrayList<>();
        dicts.add(new Dict(0, "待审核"));
        dicts.add(new Dict(1, "已同意"));
        dicts.add(new Dict(2, "被驳回"));
        dict.put("agreeIs", dicts);
    }

    public static String getValue(String key, Object code){
        List<Dict> dicts = dict.get(key);
        for (Dict dict : dicts) {
            if (dict.getCode().equals(code)){
                return dict.getValue();
            }
        }
        return key;
    }


    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    static class Dict{
        private Object code;
        private String value;
    }

}
